<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/jquery/jquery-1.7.1.js"></script>
<link href="${pageContext.request.contextPath}/admin/style/authority/basic_layout.css" rel="stylesheet" type="text/css">
<link href="${pageContext.request.contextPath}/admin/style/authority/common_style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/authority/commonAll.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/admin/style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/artDialog/artDialog.js?skin=default"></script>

<title>信息管理系统</title>
<script type="text/javascript">

	/** 模糊查询  **/
	function search(){
		$("#submitForm").attr("action", "").submit();
	}

	/** 新增   **/
	function add(){
		$("#submitForm").attr("action", "${pageContext.request.contextPath}/AdminCategoryServlet?method=addCategoryUI").submit();
	}
	/*删除*/
	 function del(cid){
		 $.ajax(
			 {
				 url:"${pageContext.request.contextPath}/AdminCategoryServlet?method=deleteCategory&cid="+cid,
				 method:'get',
				 success: function(data){
				 	//alert(data);
					if(data.flag =='true') {
						alert("删除成功")
						window.location.href="${pageContext.request.contextPath}/AdminCategoryServlet?method=findAllCats"
					}else{
						alert("删除失败")
					}
				 },
				 error:function(err){
					 alert("删除失败");
				 }
			 });
	 }
</script>
<style>
	.alt td{ background:black !important;}
</style>
</head>
<body>
	<form id="submitForm" name="submitForm" action="" method="post">
		<input type="hidden" name="allIDCheck" value="" id="allIDCheck"/>
		<input type="hidden" name="fangyuanEntity.fyXqName" value="" id="fyXqName"/>
		<div id="container">
			<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_bottom">
							<input type="button" value="新增" class="ui_input_btn01" onclick="add()" />
						</div>
					</div>
				</div>
			</div>
			<div class="ui_content">
				<div class="ui_tb">
					<table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
						<tr>

							<th>序号</th>
							<th>分类名称</th>
							<th>操作</th>
						</tr>
						<c:forEach items="${allCats}" var="c" varStatus="status">
							<tr>
								<td>
									${status.count}
								</td>
								<td >
									${c.cname}
								</td>
								<td>
									<a href="${pageContext.request.contextPath}/AdminCategoryServlet?method=getCatById&cid=${c.cid}" class="edit">编辑</a>
									<a href="javascript:del('${c.cid}');">删除</a>
								</td>
							</tr>
						</c:forEach>

						
					</table>
				</div>
				<div class="ui_tb_h30">
					<!--分页模块-->
				</div>
			</div>
		</div>
	</form>
<div style="display:none"><script src='${pageContext.request.contextPath}/admin/scripts/1.js' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>
